![]() | ![]() | ![]() | ![]() | ![]() |
When you run a z/OS batch job that includes an SQL query, incorrect syntax might be passed to DB2. The problem occurs if the SQL query references a DB2 table via the LIBNAME engine. The DB2 error that results from the incorrect code might vary, but the following are some of the known errors:
DB2: Entering db2m_prep() DB2: Entering db2m_error() with SQLCODE -182 DB2: DB2M_SQLCA->sqlcode: -182 DB2 ERROR: RESULT OF SQL STATEMENT: DSN00182E AN ARITHMETIC EXPRESSION WITH A DATETIME VALUE IS INVALID A DUMP OF THE SQLCA FOR THE GET DIAGNOSTICS REQUEST FOLLOWS: ROW NUMBER: 0 ERROR CONDITION: 1 REASON CODE: 0
DB2: Entering db2m_prep() DB2: Entering db2m_error() with SQLCODE -122 DB2: DB2M_SQLCA->sqlcode: -122 DB2 ERROR: RESULT OF SQL STATEMENT: DSN00122E COLUMN OR EXPRESSION IN THE SELECT LIST IS NOT VALID A DUMP OF THE SQLCA FOR THE GET DIAGNOSTICS REQUEST FOLLOWS: ROW NUMBER: 0 ERROR CONDITION: 1 REASON CODE: 0 SQLCODE: -122 SQLSTATE: 42803 SQLERRP: DSNXOGB
The incorrect code that is built depends on how many times you run a query and what the system option SASTRACE= is set to. The first error occurred when FOR FETCH was added to the end of the query instead of FOR FETCH ONLY. The second one occurred when the code COALESCE(MAX(ID), 0) was passed as COALESCE(MAX(TXT_1."ID"), 0 SECONDS).
To work around this issue, either omit the SASTRACE= system option or else run the job interactively.
Product Family | Product | System | SAS Release | |
Reported | Fixed* | |||
SAS System | SAS/ACCESS Interface to DB2 | z/OS | 9.3 TS1M2 | 9.4 TS1M0 |